var gulp = require("gulp");
var sass = require("gulp-sass");
var sourcemaps = require("gulp-sourcemaps");
var color = require("colors-cli/safe");
var Success = color.yellow.bold.inverse;
// sass2css task
gulp.task("sass2css", function() {
    gulp.src("./src/css/*.scss")
        .pipe(sourcemaps.init())
        .pipe(sass({ outputStyle: "compact" }).on("error", sass.logError))
        .pipe(sourcemaps.write("./sourcemaps"))
        .pipe(gulp.dest("./src/css"));
    console.log(Success("报告老大:样式文件已经更新啦～～～  " + new Date().toLocaleTimeString()));
});

// watch
gulp.task("watch", function() {
    gulp.watch(
        ["./src/css/*.scss", "./src/sass/*.scss", "./src/sass/**/*.scss"], ["sass2css"]
    );
});
gulp.task("default", ["watch"], function() {
    console.log("编译成功！");
});